
global dir = ""
cd "$dir/results"

set more off
set matsize 1000
set scheme lean2 
graph set window fontface "Times New Roman"

use "$dir/data/imputed_final_data.dta", clear

mi import flong, m(imp) id(obsid_num year)
 
mi xtset obsid_num year

label var hrs_violations "Human Rights Viol."
label var ideal_diff "UNGA Ideal Pt. Dist."

label var lngdp "Ln(GDP Per Capita)"
label var gdpgrowth "GDP Growth"
label var lnpopulation "Ln(Population Size)"
label var lnoil "Ln(Oil Prod. Per Capita)"
label var polyarchy "Polyarchy"
label var presidentialism "Presidentialism"
label var mediascore "Media Freedom"
label var lnprotest "Ln(Protest)"
label var election "Election"
label var intrastate_conflict "Intrastate conflict"
label var interstate_conflict "Interstate conflict"

label var unsc_temp "UNSC Seat"
label var ally "Ally"
label var log_imports "Ln(Import from the US)"
label var log_exports "Ln(Export to the US)"
label var log_econaid "Ln(Economic Aid)"
label var log_milaid "Ln(Military Aid)"
label var visit_from_us_pres "POTUS Visit"
label var visit_in_us_any "Visit to the US"

global domesticcov = "lngdp gdpgrowth lnpopulation lnoil polyarchy presidentialism mediascore lnprotest election intrastate_conflict interstate_conflict"
global intlcov = "unsc_temp ally log_imports log_exports log_econaid log_milaid visit_from_us_pres visit_in_us_any"

gen hrs_violations_ideal_diff = hrs_violations*ideal_diff
label var hrs_violations_ideal_diff "$\times$ UNGA Ideal Pt. Dist."

****************
*** Table B3 ***
****************

eststo clear 

global spec = "fe cluster(obsid_num)"

global main = "hrs_violations ideal_diff"

eststo m1: mi estimate, post: xtreg lead_lnave_newsnum i.year $main, $spec
estadd local domesticcov ""
estadd local intlcov ""
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

eststo m2: mi estimate, post: xtreg lead_lnave_newsnum i.year $main $domesticcov, $spec
estadd local domesticcov "$\checkmark$"
estadd local intlcov ""
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

eststo m3: mi estimate, post: xtreg lead_lnave_newsnum i.year $main $domesticcov $intlcov, $spec
estadd local domesticcov "$\checkmark$"
estadd local intlcov "$\checkmark$"
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

global main = "hrs_violations hrs_violations_ideal_diff ideal_diff"

eststo m4: mi estimate, post: xtreg lead_lnave_newsnum i.year $main, $spec
estadd local domesticcov ""
estadd local intlcov ""
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

eststo m5: mi estimate, post: xtreg lead_lnave_newsnum i.year $main $domesticcov, $spec
estadd local domesticcov "$\checkmark$"
estadd local intlcov ""
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

eststo m6: mi estimate, post: xtreg lead_lnave_newsnum i.year $main $domesticcov $intlcov, $spec
estadd local domesticcov "$\checkmark$"
estadd local intlcov "$\checkmark$"
estadd local ldrfe "$\checkmark$"
estadd local yrfe "$\checkmark$"
estadd local nldr `e(N_clust)'
estadd local period "1960-2015"

esttab m1 m2 m3 m4 m5 m6 using "Table_hrviolations_mediaattention_mi.tex", b(3) se(3) noomitted ///
keep($main $domesticcov $intlcov) ///
order($main $domesticcov $intlcov) ///
star(+ 0.10 * 0.05 ** 0.01 *** 0.001) label ///
nomtitles nonotes nogaps ///
mgroup("Ln(Ave. \# Newsp.  Mentions)", pattern(1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(ldrfe yrfe nldr N period, labels("Leader fixed effects" "Year fixed effects" "Number of leaders" "Observations" "Period") fmt(0 0 0 0 0)) ///
replace tex
